import request from '@/utils/request'

// 从环境变量中获取域名
const domain = process.env.VUE_APP_DOMAIN || 'http://localhost:6688'

export function addVideo(data) {
  return request({
    url: `${domain}/video/add`,
    method: 'post',
    data
  })
}

export function updateVideo(data) {
  return request({
    url: `${domain}/video/update`,
    method: 'post',
    data
  })
}

export function listVideo(params) {
  return request({
    url: `${domain}/video/list`,
    method: 'get',
    params
  })
}

export function getVideo(id) {
  return request({
    url: `${domain}/video/detail`,
    method: 'get',
    params: { id }
  })
}

// 可以添加其他视频相关的 API
export function searchVideo(params) {
  return request({
    url: `${domain}/video/search`,
    method: 'get',
    params
  })
}

export function deleteVideo(id) {
  return request({
    url: `${domain}/video/delete`,
    method: 'get',
    params: { id }
  })
}
